import React from 'react';
import { NavBar, Icon } from 'antd-mobile';
import { history } from 'umi';
import './index.less';

export default function SelfHead({ title, path, rightContent }) {
  function handleClick() {
    path ? history.push(path) : history.goBack();
  }
  return (
    <div className="selfHead">
      <NavBar
        mode="light"
        icon={<Icon type="left" />}
        onLeftClick={handleClick}
        rightContent={rightContent}
      >
        {title}
      </NavBar>
    </div>
  );
}
